//
//  LGTRWZPostAddStepCell.swift
//  KJLGT
//
//  Created by jenkin on 2019/8/23.
//  Copyrig ht © 2019年 jenkin. All rights reserved.
//  添加步骤cell

import UIKit

class LGTRWZPostAddStepCell: UITableViewCell {

    var clickBlock:ClickPathBlock?
    var path:IndexPath?
    var model:Dictionary<String, Any>?
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = UITableViewCell.SelectionStyle.none
        
        let titleLabel:UILabel = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.left, textColor: TextColor, fontSize: SizeFitFloat(15), text: "添加步骤")
        self.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { (make) in
            make.left.equalTo(SizeFit(13))
            make.height.equalTo(SizeFit(15))
            make.top.equalTo(SizeFit(15))
        }
        
        let button:UIButton = LGTViewCreateUtil.share.createLGTButton(image: "addto_xiaoicon", selected: "addto_xiaoicon", dW: SizeFitFloat(5), dH: SizeFitFloat(5))
        self.addSubview(button)
        button.snp.makeConstraints { (make) in
            make.width.height.equalTo(SizeFitFloat(23))
            make.top.equalTo(SizeFit(13))
            make.right.equalTo(-SizeFit(13))
            make.bottom.equalTo(-SizeFitFloat(8))
        }
        button.addTarget(self, action: #selector(clickAction), for: UIControl.Event.touchUpInside)
    }
    
    @objc func clickAction(sender:UIButton){
        if self.clickBlock != nil {
            self.model?["addButton"] = sender
            self.clickBlock!(self.model, self.path!)
        }
    }
}
